package com.yuanduo_app.manager;

import android.media.MediaPlayer;
import android.net.Uri;
import android.widget.VideoView;

public class VideoPlayer {
    private VideoView mVideoView;

    public VideoPlayer (VideoView videoView) {
        mVideoView = videoView;
    }

    public void setOnCompletionListener (MediaPlayer.OnCompletionListener listener) {
        mVideoView.setOnCompletionListener(listener);
    }

    public void play (String path) {
        mVideoView.setVideoURI(Uri.parse(path));
        mVideoView.start();
    }

    public void resume () {
        if (!mVideoView.isPlaying()) {
            mVideoView.resume();
        }
    }

    public void pause () {
        if (mVideoView.canPause()) {
            mVideoView.pause();
        }
    }
}
